<template>
    <view class="container result" :style="themeColor">
        <view class="tip">
            <image src="@/static/img/win.png" mode=""></image>
            <text class="result-tip">恭喜您提交成功</text>

            <text class="result-tip" v-if="priceSum">申请退货金额：￥{{ priceSum }}</text>
            <text class="result-tip" v-else>{{ resultText }}</text>
        </view>
        <view class="btnslist" v-if="formapp == 0">
            <view class="btn btn-success-hollow" v-if="priceSum" @click="goReturnOrderDetial">查看退货单</view>
            <view class="btn btn-success-hollow" v-else @click="goOrderDetial">查看订单</view>
            <view class="btn btn-success" @click="backHome()">返回首页</view>
        </view>
        <view class="btnslist" v-else>
            <button class="btn" open-type="launchApp" app-parameter="wechat" binderror="launchAppError">
                返回商户
            </button>
        </view>
    </view>
</template>

<script>
import storage from "@/uni-sub-base/utils/storage.js"
export default {
    data() {
        return {
            orderId: 0,
            priceSum: null,
            resultText: "",
            formapp: 0,
        }
    },

    onLoad(e) {
        this.orderId = e.orderId
        this.priceSum = e.priceSum
        if (e.formapp) {
            this.formapp = e.formapp
        }
    },
    mounted() {
        if (this.orderId == 0) {
            this.easyToast("获取订单失败")
        }
        let webInfo = storage.getCache("webInfo")
        if (webInfo) {
            this.resultText = webInfo.PayFinishMessage ? webInfo.PayFinishMessage : ""
        }
    },
    methods: {
        goOrderDetial() {
            this.easyGoTo("/pages_shop/packet/order/orderDetail?id=" + this.orderId)
        },
        goReturnOrderDetial() {
            this.easyGoTo("/pages_shop/packet/return/returnGoods")
        },
        backHome() {
            this.easyReLaunchToHome()
        },
    },
}
</script>

<style lang="scss">
.container {
    height: 100%;
    background: $color-white;
    padding: $app-page-padding;
}
.result {
    .tip {
        height: 300rpx;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        image {
            width: 140rpx;
            height: 140rpx;
            display: block;
            margin: 0 auto;
            margin-bottom: 24rpx;
        }
        text {
            font-size: 36rpx;
        }
        .result-tip {
            margin-bottom: 20rpx;
            font-size: 28rpx;
            color: $color-gray-2;
        }
    }
    .btn {
        // height: 80rpx;
        // border-radius: $border-radius-10;
        // margin-bottom: 20rpx;
        // font-size: 32rpx;
    }
}
.btnslist {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50rpx;

    view {
        width: 256rpx;
        height: 80rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 32rpx;
        margin: 0 21rpx;
    }
    .btn {
        color: #fff;
        background: $app-color-main;
    }
}
</style>
